import axios from "axios"
export const addGoods = (parameter) => {
	return new Promise(resolve => {
		axios({
			method: "post",
			url: "api/goods/",
			data: parameter
		})
	})
}

export const getGoods = async () => {
	const res = await axios({
		method: "get",
		url: "api/goods/",
	})
	return res.data
}

export const removeGoods = async (_id) => {
	const res = await axios({
		method: "delete",
		url: "api/goods/" + _id,
	})
	return res.data
}

export const updateGoods = async (_id, parameter) => {
	const res = await axios({
		method: "patch",
		url: "api/goods/" + _id,
		data: parameter
	})
	return res.data
}
